package zhr;

import java.util.Scanner;

public class ex2_10 {
    public static void main(String[] args) {
        Scanner sin=new Scanner(System.in);
        double num1;
        double num2;
        char sign;
        double result =0;
        System.out.println("请输入第一个操作数：");
        num1 = sin.nextDouble();
        System.out.println("请输入第二个操作数：");
        num2 = sin.nextDouble();
        System.out.println("请输入第一个运算符(+、-、*、/)：");
        sign =sin.next().charAt(0);
        switch (sign){
            case '+':
                result =num1+num2;
                break;
            case '-':
                result =num1-num2;
                break;
            case '*':
                result =num1*num2;
                break;
            case '/':
                result =num1/num2;
                break;
        }
        System.out.println("运算结果为："+result);
    }
}
